package com.meituan.catering.management.product.biz.model.converter;

import com.google.common.collect.Lists;
import com.meituan.catering.management.product.biz.model.ProductMethodBO;
import com.meituan.catering.management.product.dao.model.ProductMethodDO;
import org.apache.commons.collections4.CollectionUtils;

import java.util.Collections;
import java.util.List;

/**
 * @author Believe
 * Date 2022/5/22 16:28
 */
public class ProductMethodBOConverter {
    public static List<ProductMethodBO> toProductMethodBO(List<ProductMethodDO> methodDOList) {
        if (CollectionUtils.isEmpty(methodDOList)) {
            return Collections.emptyList();
        }
        List<ProductMethodBO> methodBOList = Lists.newLinkedList();
        for (ProductMethodDO productMethodDO : methodDOList) {
            ProductMethodBO productMethodBO = new ProductMethodBO();
            productMethodBO.setId(productMethodDO.getId());
            productMethodBO.setProductId(productMethodDO.getProductId());
            productMethodBO.setTenantId(productMethodDO.getTenantId());
            productMethodBO.setGroupName(productMethodDO.getGroupName());
            productMethodBO.setName(productMethodDO.getName());
            methodBOList.add(productMethodBO);
        }
        return methodBOList;
    }
}

